<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>员工信息网页</title>
<script type="text/javascript" src="${pageContext.request.contextPath }/scripts/jquery-1.10.2.min.js"></script>
<script>
	$(function() {
		$(".del").click(function() {
			var href = $(this).attr("href");
			alert(href);
			$("form").attr("action", href).submit();
			return false;
		});

	})
</script>
</head>
<body>

	<form action="" method="POST">
		<input type="hidden" name="_method" value="DELETE" />
	</form>



	<a href="adduser">添加新员工</a>
	<br>
	<br>
	<c:if test="${empty requestScope.users }">没有任何员工信息</c:if>
	<c:if test="${!empty requestScope.users }">
		<table cellpadding="10" cellspacing="0" bordercolor="#ccc" border="1">
			<tr>
				<td>id</td>
				<td>Account</td>
				<td>password</td>
				<td>name</td>
				<td>email</td>
				<td>ip</td>
				<td>编辑</td>
				<td></td>
			</tr>

			<c:forEach items="${requestScope.users }" var="u">
				<tr>
					<td>${u.id }</td>
					<td>${u.account }</td>
					<td>${u.password }</td>
					<td>${u.name } / ${u.sex }</td>
					<td>${u.email}</td>
					<td>${u.ipLastActived }</td>
					<td><a href="adduser/${u.id }">编辑</a></td>
					<td><a class="del" href="userdel/${u.id }">删除</a></td>
				</tr>
			</c:forEach>
		</table>
	</c:if>

</body>
</html>